<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="170px">
      <el-form-item label="项目名" prop="projectName"><!--项目名-->
        <el-input
          v-model="queryParams.projectName"
          placeholder="请输入项目名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="项目地点" prop="projectLocation">
        <el-input
          v-model="queryParams.projectLocation"
          placeholder="请输入项目地点"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="项目地址" prop="projectAddress">
        <el-input
          v-model="queryParams.projectAddress"
          placeholder="请输入项目地址"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="项目类别" prop="projectAddress">
        <el-input
          v-model="queryParams.porjectType"
          placeholder="请输入项目类别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <!--      <el-form-item label="建设单位名称" prop="companyName">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.companyName"-->
      <!--          placeholder="请输入建设单位名称"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="社会信用代码" prop="socialCreditCode">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.socialCreditCode"-->
      <!--          placeholder="请输入社会信用代码"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="建设单位地址" prop="constructionUnitAddress">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.constructionUnitAddress"-->
      <!--          placeholder="请输入建设单位地址"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="归属档案馆" prop="archivesBelong">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.archivesBelong"-->
      <!--          placeholder="请输入归属档案馆"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="责任人" prop="responsiblePerson">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.responsiblePerson"-->
      <!--          placeholder="请输入责任人"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="责任人电话" prop="responsiblePersonPhone">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.responsiblePersonPhone"-->
      <!--          placeholder="请输入责任人电话"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="档案员" prop="filer">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.filer"-->
      <!--          placeholder="请输入档案员"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="档案员电话" prop="filerNumber">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.filerNumber"-->
      <!--          placeholder="请输入档案员电话"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="立项批准单位" prop="projectApprovalUnit">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.projectApprovalUnit"-->
      <!--          placeholder="请输入立项批准单位"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="设计单位" prop="designUnit">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.designUnit"-->
      <!--          placeholder="请输入设计单位"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="勘察单位" prop="surveyUnit">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.surveyUnit"-->
      <!--          placeholder="请输入勘察单位"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="监理单位" prop="supervisionUnit">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.supervisionUnit"-->
      <!--          placeholder="请输入监理单位"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="施工单位" prop="constructionUnit">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.constructionUnit"-->
      <!--          placeholder="请输入施工单位"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="设计号" prop="designNumber">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.designNumber"-->
      <!--          placeholder="请输入设计号"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="立项批准文号" prop="projectApprovalNumber">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.projectApprovalNumber"-->
      <!--          placeholder="请输入立项批准文号"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="建设工程规划许可证号" prop="constructionEngineeringPlanningLicenseNumber">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.constructionEngineeringPlanningLicenseNumber"-->
      <!--          placeholder="请输入建设工程规划许可证号"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="建设土地规划许可证号" prop="constructionLandPlanningLicenseNumber">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.constructionLandPlanningLicenseNumber"-->
      <!--          placeholder="请输入建设土地规划许可证号"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="国有土地使用证号" prop="stateOwnedLandUseCertificateNumber">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.stateOwnedLandUseCertificateNumber"-->
      <!--          placeholder="请输入国有土地使用证号"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="开工日期" prop="startDate">-->
      <!--        <el-date-picker clearable-->
      <!--          v-model="queryParams.startDate"-->
      <!--          type="date"-->
      <!--          value-format="yyyy-MM-dd"-->
      <!--          placeholder="请选择开工日期">-->
      <!--        </el-date-picker>-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="竣工日期" prop="completionDate">-->
      <!--        <el-date-picker clearable-->
      <!--          v-model="queryParams.completionDate"-->
      <!--          type="date"-->
      <!--          value-format="yyyy-MM-dd"-->
      <!--          placeholder="请选择竣工日期">-->
      <!--        </el-date-picker>-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="备注信息" prop="otherInformation">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.otherInformation"-->
      <!--          placeholder="请输入备注信息"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <el-form-item label="审核状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择审核状态">
          <el-option
            v-for="dict in dict.type.shenpi"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:data:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:data:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:data:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:data:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
    </el-row>


    <el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">

      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="项目标识" align="center" prop="id" v-if="columns[0].visible"/>
      <el-table-column label="项目名" align="center" prop="projectName" v-if="columns[1].visible"/>
      <el-table-column label="项目地点" align="center" prop="projectLocation" v-if="columns[2].visible"/>
      <el-table-column label="项目地址" align="center" prop="projectAddress" v-if="columns[3].visible"/>
      <el-table-column label="项目类别" align="center" prop="porjectType" v-if="columns[4].visible"/>
      <el-table-column label="建设单位名称" align="center" prop="companyName" v-if="columns[5].visible"/>
      <el-table-column label="社会信用代码" align="center" prop="socialCreditCode" v-if="columns[6].visible"/>
      <el-table-column label="建设单位地址" align="center" prop="constructionUnitAddress" v-if="columns[7].visible"/>
      <el-table-column label="归属档案馆" align="center" prop="archivesBelong" v-if="columns[8].visible"/>
      <el-table-column label="责任人" align="center" prop="responsiblePerson" v-if="columns[9].visible"/>
      <el-table-column label="责任人电话" align="center" prop="responsiblePersonPhone" v-if="columns[10].visible"/>
      <el-table-column label="档案员" align="center" prop="filer" v-if="columns[11].visible"/>
      <el-table-column label="档案员电话" align="center" prop="filerNumber" v-if="columns[12].visible"/>
      <el-table-column label="立项批准单位" align="center" prop="projectApprovalUnit" v-if="columns[13].visible"/>
      <el-table-column label="设计单位" align="center" prop="designUnit" v-if="columns[14].visible"/>
      <el-table-column label="勘察单位" align="center" prop="surveyUnit" v-if="columns[15].visible"/>
      <el-table-column label="监理单位" align="center" prop="supervisionUnit" v-if="columns[16].visible"/>
      <el-table-column label="施工单位" align="center" prop="constructionUnit" v-if="columns[17].visible"/>
      <el-table-column label="设计号" align="center" prop="designNumber" v-if="columns[18].visible"/>
      <el-table-column label="立项批准文号" align="center" prop="projectApprovalNumber" v-if="columns[19].visible"/>
      <el-table-column label="立项批准附件文件地址" align="center" prop="projectApprovalFile" v-if="columns[20].visible">
        <template slot-scope="scope">
          <el-link
            :href="`${baseURL}${scope.row.projectApprovalFile}`"
            :underline="false" target="_blank">
            <span class="el-icon-document">
              {{ getFileName(scope.row.projectApprovalFile) }}
            </span>
          </el-link>
        </template>
      </el-table-column>
      <el-table-column label="建设工程规划许可证号" align="center" prop="constructionEngineeringPlanningLicenseNumber" v-if="columns[21].visible"/>
      <el-table-column label="建设工程规划许可证附件文件地址" align="center" prop="constructionEngineeringPlanningLicenseFile" v-if="columns[22].visible">
        <template slot-scope="scope">
          <el-link
            :href="`${baseURL}${scope.row.constructionEngineeringPlanningLicenseFile}`"
            :underline="false" target="_blank">
            <span class="el-icon-document">
              {{ getFileName(scope.row.constructionEngineeringPlanningLicenseFile) }}
            </span>
          </el-link>
        </template>
      </el-table-column>
      <el-table-column label="建设土地规划许可证号" align="center" prop="constructionLandPlanningLicenseNumber" v-if="columns[23].visible"/>
      <el-table-column label="建设土地规划许可证附件文件地址" align="center" prop="constructionLandPlanningLicenseFile" v-if="columns[24].visible">
        <template slot-scope="scope">
          <el-link
            :href="`${baseURL}${scope.row.constructionLandPlanningLicenseFile}`"
            :underline="false" target="_blank">
            <span class="el-icon-document">
              {{ getFileName(scope.row.constructionLandPlanningLicenseFile) }}
            </span>
          </el-link>
        </template>
      </el-table-column>
      <el-table-column label="国有土地使用证号" align="center" prop="stateOwnedLandUseCertificateNumber" v-if="columns[25].visible"/>
      <el-table-column label="国有土地使用证附件文件地址" align="center" prop="stateOwnedLandUseCertificateFile" v-if="columns[26].visible">
        <template slot-scope="scope">
          <el-link
            :href="`${baseURL}${scope.row.stateOwnedLandUseCertificateFile}`"
            :underline="false" target="_blank">
            <span class="el-icon-document">
              {{ getFileName(scope.row.stateOwnedLandUseCertificateFile) }}
            </span>
          </el-link>
        </template>
      </el-table-column>
      <el-table-column label="开工日期" align="center" prop="startDate" width="180" v-if="columns[27].visible">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="竣工日期" align="center" prop="completionDate" width="180" v-if="columns[28].visible">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.completionDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="备注信息" align="center" prop="otherInformation" v-if="columns[29].visible"/>
      <el-table-column label="审核状态" align="center" prop="status">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.shenpi" :value="scope.row.status"/>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handlePass(scope.row)"
            v-hasPermi="['system:data:edit']"
          >通过</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:data:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:data:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改【请填写功能名称】对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="项目名" prop="projectName">
          <el-input v-model="form.projectName" placeholder="请输入项目名" />
        </el-form-item>
        <el-form-item label="项目地点" prop="projectLocation">
          <el-input v-model="form.projectLocation" placeholder="请输入项目地点" />
        </el-form-item>
        <el-form-item label="项目地址" prop="projectAddress">
          <el-input v-model="form.projectAddress" placeholder="请输入项目地址" />
        </el-form-item>
        <el-form-item label="项目类别" prop="porjectType">
          <el-input v-model="form.porjectType" placeholder="请输入项目类别" />
        </el-form-item>
        <el-form-item label="建设单位名称" prop="companyName">
          <el-input v-model="form.companyName" placeholder="请输入建设单位名称" />
        </el-form-item>
        <el-form-item label="社会信用代码" prop="socialCreditCode">
          <el-input v-model="form.socialCreditCode" placeholder="请输入社会信用代码" />
        </el-form-item>
        <el-form-item label="建设单位地址" prop="constructionUnitAddress">
          <el-input v-model="form.constructionUnitAddress" placeholder="请输入建设单位地址" />
        </el-form-item>
        <el-form-item label="归属档案馆" prop="archivesBelong">
          <el-input v-model="form.archivesBelong" placeholder="请输入归属档案馆" />
        </el-form-item>
        <el-form-item label="责任人" prop="responsiblePerson">
          <el-input v-model="form.responsiblePerson" placeholder="请输入责任人" />
        </el-form-item>
        <el-form-item label="责任人电话" prop="responsiblePersonPhone">
          <el-input v-model="form.responsiblePersonPhone" placeholder="请输入责任人电话" />
        </el-form-item>
        <el-form-item label="档案员" prop="filer">
          <el-input v-model="form.filer" placeholder="请输入档案员" />
        </el-form-item>
        <el-form-item label="档案员电话" prop="filerNumber">
          <el-input v-model="form.filerNumber" placeholder="请输入档案员电话" />
        </el-form-item>
        <el-form-item label="立项批准单位" prop="projectApprovalUnit">
          <el-input v-model="form.projectApprovalUnit" placeholder="请输入立项批准单位" />
        </el-form-item>
        <el-form-item label="设计单位" prop="designUnit">
          <el-input v-model="form.designUnit" placeholder="请输入设计单位" />
        </el-form-item>
        <el-form-item label="勘察单位" prop="surveyUnit">
          <el-input v-model="form.surveyUnit" placeholder="请输入勘察单位" />
        </el-form-item>
        <el-form-item label="监理单位" prop="supervisionUnit">
          <el-input v-model="form.supervisionUnit" placeholder="请输入监理单位" />
        </el-form-item>
        <el-form-item label="施工单位" prop="constructionUnit">
          <el-input v-model="form.constructionUnit" placeholder="请输入施工单位" />
        </el-form-item>
        <el-form-item label="设计号" prop="designNumber">
          <el-input v-model="form.designNumber" placeholder="请输入设计号" />
        </el-form-item>
        <el-form-item label="立项批准文号" prop="projectApprovalNumber">
          <el-input v-model="form.projectApprovalNumber" placeholder="请输入立项批准文号" />
        </el-form-item>
        <el-form-item label="立项批准附件文件地址" prop="projectApprovalFile">
          <file-upload v-model="form.projectApprovalFile"/>
        </el-form-item>
        <el-form-item label="建设工程规划许可证号" prop="constructionEngineeringPlanningLicenseNumber">
          <el-input v-model="form.constructionEngineeringPlanningLicenseNumber" placeholder="请输入建设工程规划许可证号" />
        </el-form-item>
        <el-form-item label="建设工程规划许可证附件文件地址" prop="constructionEngineeringPlanningLicenseFile">
          <file-upload v-model="form.constructionEngineeringPlanningLicenseFile"/>
        </el-form-item>
        <el-form-item label="建设土地规划许可证号" prop="constructionLandPlanningLicenseNumber">
          <el-input v-model="form.constructionLandPlanningLicenseNumber" placeholder="请输入建设土地规划许可证号" />
        </el-form-item>
        <el-form-item label="建设土地规划许可证附件文件地址" prop="constructionLandPlanningLicenseFile">
          <file-upload v-model="form.constructionLandPlanningLicenseFile" />
        </el-form-item>
        <el-form-item label="国有土地使用证号" prop="stateOwnedLandUseCertificateNumber">
          <el-input v-model="form.stateOwnedLandUseCertificateNumber" placeholder="请输入国有土地使用证号" />
        </el-form-item>
        <el-form-item label="国有土地使用证附件文件地址" prop="stateOwnedLandUseCertificateFile">
          <file-upload v-model="form.stateOwnedLandUseCertificateFile"/>
        </el-form-item>`
        <el-form-item label="开工日期" prop="startDate">
          <el-date-picker clearable
                          v-model="form.startDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择开工日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="竣工日期" prop="completionDate">
          <el-date-picker clearable
                          v-model="form.completionDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择竣工日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="备注信息" prop="otherInformation">
          <el-input v-model="form.otherInformation" placeholder="请输入备注信息" />
        </el-form-item>
        <el-form-item label="审核状态" prop="status">
          <el-select v-model="form.status" placeholder="请选择审核状态">
            <el-option
              v-for="dict in dict.type.shenpi"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog >
    <el-dialog :title="title" :visible.sync="cooperateOpen" width="500px" append-to-body>

    </el-dialog>
  </div>
</template>

<script>
  import { listData, getData, delData, addData, updateData } from "@/api/system/data";

  export default {
    name: "Data",
    dicts: ['shenpi'],
    data() {
      return {
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 【请填写功能名称】表格数据
        dataList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 列信息
        columns: [
          { key: 0, label: `项目标识`, visible: false },
          { key: 1, label: `项目名`, visible: true },
          { key: 2, label: `项目地点`, visible: false },
          { key: 3, label: `项目地址`, visible: true },
          { key: 4, label: `项目类别`, visible: false },
          { key: 5, label: `建设单位名称`, visible: false },
          { key: 6, label: `社会信用代码`, visible: false },
          { key: 7, label: `建设单位地址`, visible: false },
          { key: 8, label: `归属档案馆`, visible: false },
          { key: 9, label: `责任人`, visible: true },
          { key: 10, label: `责任人电话`, visible: false },
          { key: 11, label: `档案员`, visible: false },
          { key: 12, label: `档案员电话`, visible: false },
          { key: 13, label: `立项批准单位`, visible: false },
          { key: 14, label: `设计单位`, visible: false },
          { key: 15, label: `勘察单位`, visible: false },
          { key: 16, label: `监理单位`, visible: false },
          { key: 17, label: `施工单位`, visible: false },
          { key: 18, label: `设计号`, visible: false },
          { key: 19, label: `立项批准文号`, visible: false },
          { key: 20, label: `立项批准附件文件地址`, visible: false },
          { key: 21, label: `建设工程规划许可证号`, visible: false },
          { key: 22, label: `建设工程规划许可证附件地址`, visible: false },
          { key: 23, label: `建设土地规划许可证号`, visible: false },
          { key: 24, label: `建设土地规划许可证附件地址`, visible: false },
          { key: 25, label: `国有土地许可证号`, visible: false },
          { key: 26, label: `国有土地许可证附件地址`, visible: false },
          { key: 27, label: `开工日期`, visible: false },
          { key: 28, label: `竣工日期`, visible: false },
          { key: 29, label: `备注信息`, visible: false },
          { key: 30, label: `审核状态`, visible: true },
        ],
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          projectName: null,
          projectLocation: null,
          projectAddress: null,
          porjectType: null,
          companyName: null,
          socialCreditCode: null,
          constructionUnitAddress: null,
          archivesBelong: null,
          responsiblePerson: null,
          responsiblePersonPhone: null,
          filer: null,
          filerNumber: null,
          projectApprovalUnit: null,
          designUnit: null,
          surveyUnit: null,
          supervisionUnit: null,
          constructionUnit: null,
          designNumber: null,
          projectApprovalNumber: null,
          projectApprovalFile: null,
          constructionEngineeringPlanningLicenseNumber: null,
          constructionEngineeringPlanningLicenseFile: null,
          constructionLandPlanningLicenseNumber: null,
          constructionLandPlanningLicenseFile: null,
          stateOwnedLandUseCertificateNumber: null,
          stateOwnedLandUseCertificateFile: null,
          startDate: null,
          completionDate: null,
          otherInformation: null,
          status: null
        },
        statusOptions: [{
          "label": "受理",
          "value": 1
        }, {
          "label": "驳回",
          "value": 2
        }, {
          "label": "未处理",
          "value": 3
        }],
        // 表单参数
        form: {},
        baseURL:process.env.VUE_APP_BASE_API,
        // 表单校验
        rules: {
          projectName: [
            { required: true, message: "项目名不能为空", trigger: "blur" }
          ],
          projectLocation: [
            { required: true, message: "项目地点不能为空", trigger: "blur" }
          ],
          projectAddress: [
            { required: true, message: "项目地址不能为空", trigger: "blur" }
          ],
          porjectType: [
            { required: true, message: "项目类别不能为空", trigger: "change" }
          ],
          companyName: [
            { required: true, message: "建设单位名称不能为空", trigger: "blur" }
          ],
          socialCreditCode: [
            { required: true, message: "社会信用代码不能为空", trigger: "blur" }
          ],
          constructionUnitAddress: [
            { required: true, message: "建设单位地址不能为空", trigger: "blur" }
          ],
          archivesBelong: [
            { required: true, message: "归属档案馆不能为空", trigger: "blur" }
          ],
          responsiblePerson: [
            { required: true, message: "责任人不能为空", trigger: "blur" }
          ],
          responsiblePersonPhone: [
            { required: true, message: "责任人电话不能为空", trigger: "blur" }
          ],
          filer: [
            { required: true, message: "档案员不能为空", trigger: "blur" }
          ],
          filerNumber: [
            { required: true, message: "档案员电话不能为空", trigger: "blur" }
          ],
          projectApprovalUnit: [
            { required: true, message: "立项批准单位不能为空", trigger: "blur" }
          ],
          designUnit: [
            { required: true, message: "设计单位不能为空", trigger: "blur" }
          ],
          surveyUnit: [
            { required: true, message: "勘察单位不能为空", trigger: "blur" }
          ],
          supervisionUnit: [
            { required: true, message: "监理单位不能为空", trigger: "blur" }
          ],
          constructionUnit: [
            { required: true, message: "施工单位不能为空", trigger: "blur" }
          ],
          designNumber: [
            { required: true, message: "设计号不能为空", trigger: "blur" }
          ],
          projectApprovalNumber: [
            { required: true, message: "立项批准文号不能为空", trigger: "blur" }
          ],
          projectApprovalFile: [
            { required: true, message: "立项批准附件文件地址不能为空", trigger: "blur" }
          ],
          constructionEngineeringPlanningLicenseNumber: [
            { required: true, message: "建设工程规划许可证号不能为空", trigger: "blur" }
          ],
          constructionEngineeringPlanningLicenseFile: [
            { required: true, message: "建设工程规划许可证附件文件地址不能为空", trigger: "blur" }
          ],
          constructionLandPlanningLicenseNumber: [
            { required: true, message: "建设土地规划许可证号不能为空", trigger: "blur" }
          ],
          constructionLandPlanningLicenseFile: [
            { required: true, message: "建设土地规划许可证附件文件地址不能为空", trigger: "blur" }
          ],
          stateOwnedLandUseCertificateNumber: [
            { required: true, message: "国有土地使用证号不能为空", trigger: "blur" }
          ],
          stateOwnedLandUseCertificateFile: [
            { required: true, message: "国有土地使用证附件文件地址不能为空", trigger: "blur" }
          ],
          startDate: [
            { required: true, message: "开工日期不能为空", trigger: "blur" }
          ],
          completionDate: [
            { required: true, message: "竣工日期不能为空", trigger: "blur" }
          ],
          status: [
            { required: true, message: "案卷状态不能为空", trigger: "change" }
          ]
        },
        //是否打开协作界面
        cooperateOpen: false
      };
    },
    created() {
      this.getList();
    },
    methods: {
      /** 查询【请填写功能名称】列表 */
      getList() {
        this.loading = true;
        listData(this.queryParams).then(response => {
          this.dataList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.reset();
      },
      // 表单重置
      reset() {
        this.form = {
          id: null,
          projectName: null,
          projectLocation: null,
          projectAddress: null,
          porjectType: null,
          companyName: null,
          socialCreditCode: null,
          constructionUnitAddress: null,
          archivesBelong: null,
          responsiblePerson: null,
          responsiblePersonPhone: null,
          filer: null,
          filerNumber: null,
          projectApprovalUnit: null,
          designUnit: null,
          surveyUnit: null,
          supervisionUnit: null,
          constructionUnit: null,
          designNumber: null,
          projectApprovalNumber: null,
          projectApprovalFile: null,
          constructionEngineeringPlanningLicenseNumber: null,
          constructionEngineeringPlanningLicenseFile: null,
          constructionLandPlanningLicenseNumber: null,
          constructionLandPlanningLicenseFile: null,
          stateOwnedLandUseCertificateNumber: null,
          stateOwnedLandUseCertificateFile: null,
          startDate: null,
          completionDate: null,
          otherInformation: null,
          status: null
        };
        this.resetForm("form");
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.id)
        this.single = selection.length!==1
        this.multiple = !selection.length
      },
      /** 新增按钮操作 */
      handleAdd() {
        this.reset();
        this.open = true;
        this.title = "添加【请填写功能名称】";
      },
      /** 修改按钮操作 */
      handleUpdate(row) {
        this.reset();
        const id = row.id || this.ids
        getData(id).then(response => {
          this.form = response.data;
          this.open = true;
          this.title = "修改【请填写功能名称】";
        });
      },
      /** 提交按钮 */
      submitForm() {
        this.$refs["form"].validate(valid => {
          if (valid) {
            if (this.form.id != null) {
              updateData(this.form).then(response => {
                this.$modal.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              });
            } else {
              addData(this.form).then(response => {
                this.$modal.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              });
            }
          }
        });
      },
      /** 删除按钮操作 */
      handleDelete(row) {
        const ids = row.id || this.ids;
        this.$modal.confirm('是否确认删除【请填写功能名称】编号为"' + ids + '"的数据项？').then(function() {
          return delData(ids);
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        }).catch(() => {});
      },
      /** 导出按钮操作 */
      handleExport() {
        this.download('system/data/export', {
          ...this.queryParams
        }, `data_${new Date().getTime()}.xlsx`)
      },
      // 获取文件名称
      getFileName(name) {
        // 如果是url那么取最后的名字 如果不是直接返回
        if (name.lastIndexOf("/") > -1) {
          return name.slice(name.lastIndexOf("/") + 1);
        } else {
          return name;
        }
      },
      handlePass(row){
        row.status="受理"
        updateData(row).then(response => {
          this.$modal.msgSuccess("审批通过");
          this.open = false;
          this.getList();
        })
      }
    }
  };
</script>
